<?php 
	global $object, $current_controller;

	//header container
	echo "<div id = 'page_header'>";
    	
    	//role delegations
    	echo "<div style = 'text-align: right; '>";
        	if ($object->config->use_delegations)
        	{
        		XHTML::Anchor('/systemdelegations/add/url', ' <b>|</b> '.ucfirst(LANG_URL_DELEGATION),  "style = 'color: #666666'");
        		XHTML::Anchor('/systemdelegations/add/roles', ' <b>|</b> '.ucfirst(LANG_ROLES_DELEGATION),  "style = 'color: #666666'");
        	}
        echo "</div>";
        
    	//global menu
    	foreach (Menus::$global as $key => &$value)
    	{
    	    //access check
    		if ($object->config->use_table_access)
    		{
    		    //if access is forbidden to the whole module
    			if (!array_key_exists($key, $_SESSION['modules_access']))
    			{
    			    continue;
    			}
    		}    				
    		    			
    		//determine whether the module is active
    		if ($current_controller->module == $key) 
    		{
    			$value['active'] = true;
    		}
    		else
    		{
    			$value['active'] = false;
    		}
    		
    		//text modifications
    		$value['text'] = ucfirst($value['text']);
    	}
    	
    	//generates logout link if the user is logged in
    	if (isset($_SESSION['userid']))
    	{
    	    Menus::$global[] = array('url' => '/main/logout/', 'text' => Language::Get('logout', 'CAPITALIZE').'('.$_SESSION['userlogin'].')');
    	}

    	//generates global menu
        jQuery::TabsBar('global_menu', Menus::$global);
	
    echo "</div>";   
    
    //minimixe/maximize separator
    echo "<div style = 'background-color: #EEEEEE; text-align: center; border-bottom: 1px solid gray; width: 100%; '>";
        XHTML::Anchor('', "<img src = '".IMAGES."arrow_top_black.gif' id = 'header_separator_image' />", array
            (
            	'id' => '', 
            	'onclick' => '
            		$("#page_header").toggle();
            		if ($("#header_separator_image").attr("src") == "'.IMAGES.'arrow_top_black.gif") 
            		{
            			$("#header_separator_image").attr("src", "'.IMAGES.'arrow_bottom_black.gif");
            		}
            		else
            		{
            			$("#header_separator_image").attr("src", "'.IMAGES.'arrow_top_black.gif");
            		}
            		SendValues("/main/toggleheader/");
            		return false; '
            )
        );    	
    echo "</div>";
?>